package org.liveboardgames.agricola.business.helper;

import org.liveboardgames.agricola.domain.common.SpecialPoint;
import org.liveboardgames.agricola.domain.player.Player;
import org.liveboardgames.agricola.model.enums.SpecialPointConditionEnum;

public class SpecialPointsComputer {

  public int computeSpecialPoints(Player player, SpecialPoint specialPoint) {
    int points = 0;

    String condition = specialPoint.getCondition();
    Integer quantity = specialPoint.getQuantity();
    // Target is not used for now. Later on, with the cards...
    // String target = specialPoint.getTarget();
    Integer awardedPoints = specialPoint.getPoints();

    String resourceType = SpecialPointConditionEnum.toResourceType(condition);
    int resource = player.getFarm().getResourceQuantity(resourceType);
    if (resource > quantity) {
      points = awardedPoints;
    }

    return points;
  }
}
